package cubelabs.nexus.entity;


import java.util.Date;

import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.ManyToOne;

@Entity
public class Event extends BaseEntity{
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

    @Id
    public Long id;


    public String title;

    public Boolean allDay;

    public Date start = new Date();

    public Date end = new Date();

    public Boolean endsSameDay;
    
    public String description;
    
    public EventType eventType;
    
    @ManyToOne
//    @JsonIgnore
    public User user;

    public Date creationDate;
    
    public Event(String title, Date start, Date end, Boolean allDay) {
        this.title = title;
        this.start = start;
        this.end = end;
        this.allDay = allDay;

    }


    public Event() {
	}


/*	public static List<Event> findInDateRange(Date start, Date end) {


        return find.where().or(
                Expr.and(
                        Expr.lt("start", start),
                        Expr.gt("end", end)
                ),
                Expr.or(
                        Expr.and(
                                Expr.gt("start", start),
                                Expr.lt("start", end)
                        ),
                        Expr.and(
                                Expr.gt("end", start),
                                Expr.lt("end", end)
                        )
                )
        ).findList();
    }


    public static Event findByEventId(Long eventId){
    	return find.where().eq("id", eventId).findUnique();
    }
*/
}
